from collections import OrderedDict

d = OrderedDict()
d['a'] = 'A'
d['b'] = 'B'
d['c'] = 'C'

print('Before: ')
for k, v in d.items():
    print(k, v)

d.move_to_end('b')

print('Move to end:')
for k, v in d.items():
    print(k, v)

d.move_to_end('b', last=False)

print('Move to start:')
for k, v in d.items():
    print(k, v)
